package com.niodata.dp.task.service;

import com.niodata.dp.task.PluginPackageStoreV2;
import com.niodata.dp.task.entity.PluginCategoryCountSta;
import com.niodata.dp.task.entity.PluginDocument;
import com.niodata.dp.task.entity.PluginDocumentView;
import com.niodata.dp.task.entity.v2.PluginPackageV2;
import com.niodata.dp.task.entity.v2.PluginPackageViewV2;
import java.io.IOException;
import java.util.List;

public interface PluginManagerV2 extends PluginPackageStoreV2, PluginTaskUseAgeListener {

  public PluginCategoryCountSta getPluginCategoryCount(long userId);

  public PluginCategoryCountSta getPublicToHubPluginCategoryCount();

  public List<PluginPackageViewV2> getPlugins(long userId,
      String sysCategory,
      String funcCategory,
      String nameContains,
      int offset,
      int maxCount);

  public List<PluginPackageViewV2> getPluginsPlublicToHub(
      String sysCategory,
      String funcCategory,
      String nameContains,
      int offset,
      int maxCount);

  public PluginPackageV2 getPluginByNameVersion(long userid, String name, String version);

  public PluginDocument getPluginDocument(long userid, String name, String version);

  public PluginDocumentView getPluginDocumentView(long userId, String name, String version);

  public PluginDocumentView getPluginDocumentView(long userId, String pkgId);

  public void updateDocument(PluginDocument document);

  public void savePlugin(PluginPackageV2 jobPackage, String document);

  public PluginPackageV2 getPlugin(String id);

  public PluginPackageV2 getPlugin(String name, String version);

  public List<PluginPackageV2> getAllPlugins();


  public boolean isRemoteStoreDfs();

  /**
   * remove package.
   *
   * @param name package name
   * @param version package version
   */
  public void removePlugin(String name, String version) throws IOException;

  public List<PluginPackageV2> getPluginsByName(String name);

  public List<String> getPluginTypes();

  public List<String> getSysCategories();

  public List<String> getFuncCategories(String sysCategory);

  public void update(PluginPackageV2 pluginPackage);

  public void updatePluginUseCount(String pkgId);

  public String genUsageMd(PluginPackageV2 pluginPackage) throws Exception;


}
